package dao

import (
	"github.com/dgrijalva/jwt-go"
	"github.com/google/uuid"
	"time"
)

// 用户注册参数
type Register struct {
	Username    string `json:"username" form:"username"`
	Password    string `json:"password" form:"password"`
	NickName    string `json:"nick_name" form:"nick_name"`
	HeaderImg   string `json:"header_img" form:"header_img"`
	AuthorityId string `json:"authority_id" form:"authority_id"`
}

// 用户登陆参数
type Login struct {
	Username  string `json:"username" form:"username" v:"username"`
	Password  string `json:"password" form:"password" v:"password"`
	Captcha   string `json:"captcha" form:"captcha" v:"captcha"`
	CaptchaId string `json:"captcha_id" form:"captcha_id" v:"captcha_id"`
}

// 用户登陆,验证码参数
type SysCaptchaResponse struct {
	CaptchaId string `json:"captcha_id"`
	PicPath   string `json:"pic_path"`
}

// 这是受token保护的 信息
type JwtClaims struct {
	UUID        string
	ID          int
	Username    string
	NickName    string
	AuthorityId string
	BufferTime  int64
	jwt.StandardClaims
}
// 用户登陆成功后,返回的数据
type LoginResponse struct {
	User      SysUser `json:"user"`
	Token     string  `json:"token"`
	ExpiresAt int64   `json:"expires_at"`
}

// 用户修改密码
type ChangePassword struct {
	Username    string `json:"username" form:"username" v:"username"`
	Password    string `json:"password" form:"password" v:"password"`
	NewPassword string `json:"new_password" form:"new_password" v:"new_password"`
}

type UserListResp struct {
	AuthorityId string    `json:"authority_id" form:"authority_id"`
	CreatedAt   time.Time `json:"created_at" form:"created_at"`
	DeletedAt   time.Time `json:"deleted_at" form:"deleted_at"`
	HeaderImg   string    `json:"header_img" form:"header_img"`
	Id          int64     `json:"id" form:"id"`
	NickName    string    `json:"nick_name" form:"nick_name"`
	Password    string    `json:"password" form:"password"`
	UpdatedAt   time.Time `json:"updated_at" form:"updated_at"`
	Username    string    `json:"username" form:"username"`
	Uuid        string    `json:"uuid" form:"uuid"`
	ACreatedAt    time.Time `json:"a_created_at" form:"created_at"`
	ADeletedAt    time.Time `json:"a_deleted_at" form:"deleted_at"`
	AUpdatedAt    time.Time `json:"a_updated_at" form:"updated_at"`
	AuthorityName string    `json:"authority_name" form:"authority_name"`
	DefaultRouter string    `json:"default_router" form:"default_router"`
	ParentId      string    `json:"parent_id" form:"parent_id"`
}


// 修改用户的角色
type SetUserAuth struct {
	UUID        uuid.UUID `json:"uuid" form:"uuid"`
	AuthorityId string    `json:"authority_id" form:"authority_id"`
}

type SysUserResponse struct {
	User SysUser `json:"user"`
}

// 删除用户
type GetById struct {
	Id int `json:"id" form:"id"`
}

type CasbinInReceive struct {
	AuthorityId string       `json:"authorityId"`
	CasbinInfos []CasbinInfo `json:"casbinInfos"`
}

type Page struct {
	PageNum  int `json:"page_num" form:"page_num"`
	PageSize int `json:"page_size" form:"page_size"`
}

type PageResult struct {
	List     interface{} `json:"list"`
	Total    int         `json:"total"`
	Page     int         `json:"page"`
	PageSize int         `json:"page_size"`
}

// 配置文件结构体
type System struct {
	Config Config
}

// 配置文件结构体
type SysConfigResponse struct {
	Config Config `json:"config"`
}

type IdsReq struct {
	Ids []int `json:"ids" form:"ids"`
}

type PageInfo struct {
	Page     int `json:"page" form:"page"`
	PageSize int `json:"pageSize" form:"pageSize"`
}

type SysOperationRecordSearch struct {
	SysOperationRecord
	PageInfo
}

